package com.spic.business.mountguard.service.impl;

import com.spic.business.common.datascope.anotation.BusinessDataScope;
import com.spic.business.mountguard.domain.MountSignRecord;
import com.spic.business.mountguard.mapper.MountSignRecordMapper;
import com.spic.business.mountguard.service.IMountSignRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 上岗到位签到记录Service业务层处理
 *
 * @author spic
 * @date 2021-12-06
 */
@Service
public class MountSignRecordServiceImpl implements IMountSignRecordService
{
    @Autowired
    private MountSignRecordMapper mountSignRecordMapper;

    /**
     * 查询上岗到位签到记录
     *
     * @param id 上岗到位签到记录主键
     * @return 上岗到位签到记录
     */
    @Override
    public MountSignRecord selectMountSignRecordById(String id)
    {
        return mountSignRecordMapper.selectMountSignRecordById(id);
    }

    /**
     * 查询上岗到位签到记录列表
     *
     * @param mountSignRecord 上岗到位签到记录
     * @return 上岗到位签到记录
     */
    @Override
    @BusinessDataScope(menuPath = "business/mountguard/record/index")
    public List<MountSignRecord> selectMountSignRecordList(MountSignRecord mountSignRecord)
    {
        return mountSignRecordMapper.selectMountSignRecordList(mountSignRecord);
    }

    /**
     * 新增上岗到位签到记录
     *
     * @param mountSignRecord 上岗到位签到记录
     * @return 结果
     */
    @Override
    public int insertMountSignRecord(MountSignRecord mountSignRecord)
    {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        mountSignRecord.setId(uuid);
        return mountSignRecordMapper.insertMountSignRecord(mountSignRecord);
    }

    /**
     * 修改上岗到位签到记录
     *
     * @param mountSignRecord 上岗到位签到记录
     * @return 结果
     */
    @Override
    public int updateMountSignRecord(MountSignRecord mountSignRecord)
    {
        return mountSignRecordMapper.updateMountSignRecord(mountSignRecord);
    }

    /**
     * 批量删除上岗到位签到记录
     *
     * @param ids 需要删除的上岗到位签到记录主键
     * @return 结果
     */
    @Override
    public int deleteMountSignRecordByIds(String[] ids)
    {
        return mountSignRecordMapper.deleteMountSignRecordByIds(ids);
    }

    /**
     * 删除上岗到位签到记录信息
     *
     * @param id 上岗到位签到记录主键
     * @return 结果
     */
    @Override
    public int deleteMountSignRecordById(String id)
    {
        return mountSignRecordMapper.deleteMountSignRecordById(id);
    }
}
